﻿/** 
 * Description:商品分类DAO
 * Date:2011-7-16
 * Author:Along	
*/
package com.community.shopping.dao;

import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.community.shopping.domain.GoodsType;

public class GoodsTypeDao extends HibernateDaoSupport{
	private Log log = LogFactory.getLog(GoodsTypeDao.class);  
	

	public void save(GoodsType goodsType){
		getHibernateTemplate().saveOrUpdate(goodsType);	
		log.debug("-------保存一行goodsType-------");
	}

	public void delete(GoodsType goodsType){		  
		getHibernateTemplate().delete(goodsType);
		log.debug("---------删除一行goodsType-------");
	}

    
	public List<GoodsType> getGoodsType() {  		
	 return getHibernateTemplate().find(" from GoodsType order by sort,id"); 
	 }

	public List<GoodsType> getGoodsType(String sql){
		String finalsql="from GoodsType where "+sql;
		return getHibernateTemplate().find(finalsql);
	}
	
	public GoodsType getGoodsType(Integer id){
		return getHibernateTemplate().load(GoodsType.class, id);
	}
	}
